package com.ming.demo.mapper;

import com.ming.demo.model.File;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface FileMapper {
    @Insert("insert into file(file_name, `name`, `time`, infoPeople_id) values(#{fileName}, #{name}, now(), #{infoPeople_id}); ")
    public int insertFile(@Param("name")String name, @Param("fileName")String fileName, @Param("infoPeople_id")String infoPeople_id);

    // 查询全部上传人姓名
    @Select("select distinct name from file where infoPeople_id = #{infoPeople_id}")
    public List<String> ListFindByName( String infoPeople_id);

    // 根据人名查询照片
    @Select("select distinct file_name from file where name = #{name}")
    public List<String> findNameIsUrl(@Param("name")String name);

    @Select("select * from file where name = #{name} and infoPeople_id = #{infoPeople_id}")
    public List<File> findByNamesIsUrl(@Param("name")String name, String infoPeople_id);
}
